package models;
 
import java.util.*;
import javax.persistence.*;
 
import play.db.jpa.*;
 
@Entity
public class User extends Model {
 
    //public int id;
    public String login;
    private String password;
    public String prenom;
    public String nom;
    public Date date_naissance;
    public String adresse;
    public int code_postal;
    public String ville;
    public String email;
    public Date date_creation;
    public Date date_derniere_connexion;
    public boolean isAdmin;
    public long id_trimaran;
    
    public User(String login, String password, String prenom, String nom, Date dateNaissance, String adresse, int codePostal, String ville, String email, Date dateCreation, long id_trimaran) {
        
        this.login = login;
        this.password = password;
        this.prenom = prenom;
        this.nom = nom;
        this.date_naissance = dateNaissance;
        this.adresse = adresse;
        this.code_postal = codePostal;
        this.ville = ville;
        this.email = email;
        this.date_creation = dateCreation;
        this.id_trimaran = id_trimaran;
    }
        
    public static User connect(String login, String password) 
    {
        return find("byLoginAndPassword", login, password).first();
    }
 
}

